Termination w.r.t. Q of the following Term Rewriting System could be proven:

Q restricted rewrite system:
The TRS R consists of the following rules:

g1(A) -> A
g1(B) -> A
g1(B) -> B
g1(C) -> A
g1(C) -> B
g1(C) -> C
foldB2(t, 0) -> t
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)
foldC2(t, 0) -> t
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f2(t, x) -> f'2(t, g1(x))
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
fold3(t, x, 0) -> t
fold3(t, x, s1(n)) -> f2(fold3(t, x, n), x)

Q is empty.


QTRS
  ↳ DependencyPairsProof

Q restricted rewrite system:
The TRS R consists of the following rules:

g1(A) -> A
g1(B) -> A
g1(B) -> B
g1(C) -> A
g1(C) -> B
g1(C) -> C
foldB2(t, 0) -> t
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)
foldC2(t, 0) -> t
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f2(t, x) -> f'2(t, g1(x))
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
fold3(t, x, 0) -> t
fold3(t, x, s1(n)) -> f2(fold3(t, x, n), x)

Q is empty.

Using Dependency Pairs [1,13] we result in the following initial DP problem:
Q DP problem:
The TRS P consists of the following rules:

F'2(triple3(a, b, c), A) -> FOLDB2(triple3(s1(a), 0, c), b)
FOLD3(t, x, s1(n)) -> FOLD3(t, x, n)
FOLD3(t, x, s1(n)) -> F2(fold3(t, x, n), x)
F2(t, x) -> F'2(t, g1(x))
FOLDC2(t, s1(n)) -> F2(foldC2(t, n), C)
F2(t, x) -> G1(x)
FOLDB2(t, s1(n)) -> FOLDB2(t, n)
F''1(triple3(a, b, c)) -> FOLDC2(triple3(a, b, 0), c)
FOLDC2(t, s1(n)) -> FOLDC2(t, n)
F'2(triple3(a, b, c), A) -> F''1(foldB2(triple3(s1(a), 0, c), b))
F'2(triple3(a, b, c), B) -> F2(triple3(a, b, c), A)
FOLDB2(t, s1(n)) -> F2(foldB2(t, n), B)

The TRS R consists of the following rules:

g1(A) -> A
g1(B) -> A
g1(B) -> B
g1(C) -> A
g1(C) -> B
g1(C) -> C
foldB2(t, 0) -> t
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)
foldC2(t, 0) -> t
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f2(t, x) -> f'2(t, g1(x))
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
fold3(t, x, 0) -> t
fold3(t, x, s1(n)) -> f2(fold3(t, x, n), x)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.

↳ QTRS
  ↳ DependencyPairsProof
QDP
      ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

F'2(triple3(a, b, c), A) -> FOLDB2(triple3(s1(a), 0, c), b)
FOLD3(t, x, s1(n)) -> FOLD3(t, x, n)
FOLD3(t, x, s1(n)) -> F2(fold3(t, x, n), x)
F2(t, x) -> F'2(t, g1(x))
FOLDC2(t, s1(n)) -> F2(foldC2(t, n), C)
F2(t, x) -> G1(x)
FOLDB2(t, s1(n)) -> FOLDB2(t, n)
F''1(triple3(a, b, c)) -> FOLDC2(triple3(a, b, 0), c)
FOLDC2(t, s1(n)) -> FOLDC2(t, n)
F'2(triple3(a, b, c), A) -> F''1(foldB2(triple3(s1(a), 0, c), b))
F'2(triple3(a, b, c), B) -> F2(triple3(a, b, c), A)
FOLDB2(t, s1(n)) -> F2(foldB2(t, n), B)

The TRS R consists of the following rules:

g1(A) -> A
g1(B) -> A
g1(B) -> B
g1(C) -> A
g1(C) -> B
g1(C) -> C
foldB2(t, 0) -> t
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)
foldC2(t, 0) -> t
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f2(t, x) -> f'2(t, g1(x))
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
fold3(t, x, 0) -> t
fold3(t, x, s1(n)) -> f2(fold3(t, x, n), x)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [13,14,18] contains 2 SCCs with 2 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ AND
QDP
            ↳ QDPOrderProof
          ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

F'2(triple3(a, b, c), A) -> FOLDB2(triple3(s1(a), 0, c), b)
F2(t, x) -> F'2(t, g1(x))
FOLDC2(t, s1(n)) -> F2(foldC2(t, n), C)
FOLDB2(t, s1(n)) -> FOLDB2(t, n)
F''1(triple3(a, b, c)) -> FOLDC2(triple3(a, b, 0), c)
FOLDC2(t, s1(n)) -> FOLDC2(t, n)
F'2(triple3(a, b, c), A) -> F''1(foldB2(triple3(s1(a), 0, c), b))
F'2(triple3(a, b, c), B) -> F2(triple3(a, b, c), A)
FOLDB2(t, s1(n)) -> F2(foldB2(t, n), B)

The TRS R consists of the following rules:

g1(A) -> A
g1(B) -> A
g1(B) -> B
g1(C) -> A
g1(C) -> B
g1(C) -> C
foldB2(t, 0) -> t
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)
foldC2(t, 0) -> t
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f2(t, x) -> f'2(t, g1(x))
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
fold3(t, x, 0) -> t
fold3(t, x, s1(n)) -> f2(fold3(t, x, n), x)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [13].


The following pairs can be oriented strictly and are deleted.


FOLDC2(t, s1(n)) -> F2(foldC2(t, n), C)
FOLDC2(t, s1(n)) -> FOLDC2(t, n)
The remaining pairs can at least be oriented weakly.

F'2(triple3(a, b, c), A) -> FOLDB2(triple3(s1(a), 0, c), b)
F2(t, x) -> F'2(t, g1(x))
FOLDB2(t, s1(n)) -> FOLDB2(t, n)
F''1(triple3(a, b, c)) -> FOLDC2(triple3(a, b, 0), c)
F'2(triple3(a, b, c), A) -> F''1(foldB2(triple3(s1(a), 0, c), b))
F'2(triple3(a, b, c), B) -> F2(triple3(a, b, c), A)
FOLDB2(t, s1(n)) -> F2(foldB2(t, n), B)
Used ordering: Polynomial interpretation [21]:

POL(0) = 0   
POL(A) = 0   
POL(B) = 0   
POL(C) = 1   
POL(F2(x1, x2)) = x1   
POL(F'2(x1, x2)) = x1   
POL(F''1(x1)) = x1   
POL(FOLDB2(x1, x2)) = x1   
POL(FOLDC2(x1, x2)) = 2·x1 + x2   
POL(f2(x1, x2)) = x1 + x2   
POL(f'2(x1, x2)) = x1 + x2   
POL(f''1(x1)) = x1   
POL(foldB2(x1, x2)) = x1   
POL(foldC2(x1, x2)) = 2·x1 + x2   
POL(g1(x1)) = x1   
POL(s1(x1)) = 1 + x1   
POL(triple3(x1, x2, x3)) = x3   

The following usable rules [14] were oriented:

foldB2(t, 0) -> t
g1(B) -> B
g1(C) -> C
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f2(t, x) -> f'2(t, g1(x))
g1(B) -> A
g1(A) -> A
foldC2(t, 0) -> t
g1(C) -> B
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)
g1(C) -> A



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ AND
          ↳ QDP
            ↳ QDPOrderProof
QDP
                ↳ DependencyGraphProof
          ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

F'2(triple3(a, b, c), A) -> FOLDB2(triple3(s1(a), 0, c), b)
F2(t, x) -> F'2(t, g1(x))
FOLDB2(t, s1(n)) -> FOLDB2(t, n)
F''1(triple3(a, b, c)) -> FOLDC2(triple3(a, b, 0), c)
F'2(triple3(a, b, c), B) -> F2(triple3(a, b, c), A)
F'2(triple3(a, b, c), A) -> F''1(foldB2(triple3(s1(a), 0, c), b))
FOLDB2(t, s1(n)) -> F2(foldB2(t, n), B)

The TRS R consists of the following rules:

g1(A) -> A
g1(B) -> A
g1(B) -> B
g1(C) -> A
g1(C) -> B
g1(C) -> C
foldB2(t, 0) -> t
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)
foldC2(t, 0) -> t
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f2(t, x) -> f'2(t, g1(x))
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
fold3(t, x, 0) -> t
fold3(t, x, s1(n)) -> f2(fold3(t, x, n), x)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [13,14,18] contains 1 SCC with 2 less nodes.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ AND
          ↳ QDP
            ↳ QDPOrderProof
              ↳ QDP
                ↳ DependencyGraphProof
QDP
                    ↳ QDPOrderProof
          ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

F'2(triple3(a, b, c), A) -> FOLDB2(triple3(s1(a), 0, c), b)
F2(t, x) -> F'2(t, g1(x))
FOLDB2(t, s1(n)) -> FOLDB2(t, n)
F'2(triple3(a, b, c), B) -> F2(triple3(a, b, c), A)
FOLDB2(t, s1(n)) -> F2(foldB2(t, n), B)

The TRS R consists of the following rules:

g1(A) -> A
g1(B) -> A
g1(B) -> B
g1(C) -> A
g1(C) -> B
g1(C) -> C
foldB2(t, 0) -> t
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)
foldC2(t, 0) -> t
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f2(t, x) -> f'2(t, g1(x))
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
fold3(t, x, 0) -> t
fold3(t, x, s1(n)) -> f2(fold3(t, x, n), x)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [13].


The following pairs can be oriented strictly and are deleted.


FOLDB2(t, s1(n)) -> FOLDB2(t, n)
FOLDB2(t, s1(n)) -> F2(foldB2(t, n), B)
The remaining pairs can at least be oriented weakly.

F'2(triple3(a, b, c), A) -> FOLDB2(triple3(s1(a), 0, c), b)
F2(t, x) -> F'2(t, g1(x))
F'2(triple3(a, b, c), B) -> F2(triple3(a, b, c), A)
Used ordering: Polynomial interpretation [21]:

POL(0) = 0   
POL(A) = 0   
POL(B) = 0   
POL(C) = 0   
POL(F2(x1, x2)) = 2·x1   
POL(F'2(x1, x2)) = 2·x1   
POL(FOLDB2(x1, x2)) = 2·x1 + x2   
POL(f2(x1, x2)) = x1   
POL(f'2(x1, x2)) = x1   
POL(f''1(x1)) = 2·x1   
POL(foldB2(x1, x2)) = x1   
POL(foldC2(x1, x2)) = 2·x1   
POL(g1(x1)) = 0   
POL(s1(x1)) = 1 + 2·x1   
POL(triple3(x1, x2, x3)) = 2·x2   

The following usable rules [14] were oriented:

foldB2(t, 0) -> t
foldC2(t, 0) -> t
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f2(t, x) -> f'2(t, g1(x))
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ AND
          ↳ QDP
            ↳ QDPOrderProof
              ↳ QDP
                ↳ DependencyGraphProof
                  ↳ QDP
                    ↳ QDPOrderProof
QDP
                        ↳ DependencyGraphProof
          ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

F'2(triple3(a, b, c), A) -> FOLDB2(triple3(s1(a), 0, c), b)
F2(t, x) -> F'2(t, g1(x))
F'2(triple3(a, b, c), B) -> F2(triple3(a, b, c), A)

The TRS R consists of the following rules:

g1(A) -> A
g1(B) -> A
g1(B) -> B
g1(C) -> A
g1(C) -> B
g1(C) -> C
foldB2(t, 0) -> t
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)
foldC2(t, 0) -> t
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f2(t, x) -> f'2(t, g1(x))
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
fold3(t, x, 0) -> t
fold3(t, x, s1(n)) -> f2(fold3(t, x, n), x)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [13,14,18] contains 1 SCC with 1 less node.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ AND
          ↳ QDP
            ↳ QDPOrderProof
              ↳ QDP
                ↳ DependencyGraphProof
                  ↳ QDP
                    ↳ QDPOrderProof
                      ↳ QDP
                        ↳ DependencyGraphProof
QDP
                            ↳ QDPOrderProof
          ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

F2(t, x) -> F'2(t, g1(x))
F'2(triple3(a, b, c), B) -> F2(triple3(a, b, c), A)

The TRS R consists of the following rules:

g1(A) -> A
g1(B) -> A
g1(B) -> B
g1(C) -> A
g1(C) -> B
g1(C) -> C
foldB2(t, 0) -> t
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)
foldC2(t, 0) -> t
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f2(t, x) -> f'2(t, g1(x))
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
fold3(t, x, 0) -> t
fold3(t, x, s1(n)) -> f2(fold3(t, x, n), x)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [13].


The following pairs can be oriented strictly and are deleted.


F'2(triple3(a, b, c), B) -> F2(triple3(a, b, c), A)
The remaining pairs can at least be oriented weakly.

F2(t, x) -> F'2(t, g1(x))
Used ordering: Polynomial interpretation [21]:

POL(A) = 0   
POL(B) = 1   
POL(C) = 2   
POL(F2(x1, x2)) = 2·x2   
POL(F'2(x1, x2)) = x2   
POL(g1(x1)) = 2·x1   
POL(triple3(x1, x2, x3)) = 0   

The following usable rules [14] were oriented:

g1(C) -> B
g1(B) -> B
g1(C) -> C
g1(C) -> A
g1(B) -> A
g1(A) -> A



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ AND
          ↳ QDP
            ↳ QDPOrderProof
              ↳ QDP
                ↳ DependencyGraphProof
                  ↳ QDP
                    ↳ QDPOrderProof
                      ↳ QDP
                        ↳ DependencyGraphProof
                          ↳ QDP
                            ↳ QDPOrderProof
QDP
                                ↳ DependencyGraphProof
          ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

F2(t, x) -> F'2(t, g1(x))

The TRS R consists of the following rules:

g1(A) -> A
g1(B) -> A
g1(B) -> B
g1(C) -> A
g1(C) -> B
g1(C) -> C
foldB2(t, 0) -> t
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)
foldC2(t, 0) -> t
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f2(t, x) -> f'2(t, g1(x))
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
fold3(t, x, 0) -> t
fold3(t, x, s1(n)) -> f2(fold3(t, x, n), x)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [13,14,18] contains 0 SCCs with 1 less node.

↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ AND
          ↳ QDP
QDP
            ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

FOLD3(t, x, s1(n)) -> FOLD3(t, x, n)

The TRS R consists of the following rules:

g1(A) -> A
g1(B) -> A
g1(B) -> B
g1(C) -> A
g1(C) -> B
g1(C) -> C
foldB2(t, 0) -> t
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)
foldC2(t, 0) -> t
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f2(t, x) -> f'2(t, g1(x))
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
fold3(t, x, 0) -> t
fold3(t, x, s1(n)) -> f2(fold3(t, x, n), x)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [13].


The following pairs can be oriented strictly and are deleted.


FOLD3(t, x, s1(n)) -> FOLD3(t, x, n)
The remaining pairs can at least be oriented weakly.
none
Used ordering: Polynomial interpretation [21]:

POL(FOLD3(x1, x2, x3)) = 2·x3   
POL(s1(x1)) = 1 + 2·x1   

The following usable rules [14] were oriented: none



↳ QTRS
  ↳ DependencyPairsProof
    ↳ QDP
      ↳ DependencyGraphProof
        ↳ AND
          ↳ QDP
          ↳ QDP
            ↳ QDPOrderProof
QDP
                ↳ PisEmptyProof

Q DP problem:
P is empty.
The TRS R consists of the following rules:

g1(A) -> A
g1(B) -> A
g1(B) -> B
g1(C) -> A
g1(C) -> B
g1(C) -> C
foldB2(t, 0) -> t
foldB2(t, s1(n)) -> f2(foldB2(t, n), B)
foldC2(t, 0) -> t
foldC2(t, s1(n)) -> f2(foldC2(t, n), C)
f2(t, x) -> f'2(t, g1(x))
f'2(triple3(a, b, c), C) -> triple3(a, b, s1(c))
f'2(triple3(a, b, c), B) -> f2(triple3(a, b, c), A)
f'2(triple3(a, b, c), A) -> f''1(foldB2(triple3(s1(a), 0, c), b))
f''1(triple3(a, b, c)) -> foldC2(triple3(a, b, 0), c)
fold3(t, x, 0) -> t
fold3(t, x, s1(n)) -> f2(fold3(t, x, n), x)

Q is empty.
We have to consider all minimal (P,Q,R)-chains.
The TRS P is empty. Hence, there is no (P,Q,R) chain.